<template>
	<view class="cate">
		<view class="list" v-for="v in list" :key="v.id">
			<view class="l_left">
				<view class="l_img">
					<image v-if="v.store.image" :src="http+v.store.image" mode=""></image>
				</view>
				<view class="l_text">
					<view class="">
						{{v.store.title}}
					</view>
					<view class="t_bottom">
						{{$formatDate(v.createtime*1000)}}
					</view>
				</view>
			</view>
			<view class="l_right">
				<!-- <view class="type">
					待付款
				</view> -->
				<view class="money">
					￥{{v.allprice}}
				</view>
				<!-- <view class="num">
					<text>x</text>1
				</view> -->
			</view>
		</view>
		<view class="kong" v-if="list==''">
			<view class="kong_img">
				<image src="../../static/mine/kong.png" mode=""></image>
			</view>
			<view class="kong_text">
				还没有消费，赶快去消费吧
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				type:0,
				mid:0,
				arr:['待付款','待接单','已接单'],
				http:this.$http,
				list:[]
			}
		},
		onLoad() {
			if(uni.getStorageSync('user')){
				this.mid = uni.getStorageSync('user').id
				this.$post('user/storeOrderList',{
					mid:this.mid,
					page:1,
				}).then(res=>{
					// console.log(res)
					if(res.code==0){
						this.list = res.data.list
					}
					if(res.code== -3){
						uni.showToast({
							title:'用户不存在请重新登录',
							icon:'none',
							mask:true
						})
						uni.clearStorage()
						setTimeout(()=>{
							uni.switchTab({
								url:'../index/index'
							})
						},1200)
					}
					if(res.code== -4){
						uni.showToast({
							title:'用户已被禁用',
							icon:'none',
							mask:true
						})
						// uni.clearStorage()
						setTimeout(()=>{
							uni.switchTab({
								url:'../index/index'
							})
						},1200)
					}
				})
			}
		},
		onShareAppMessage(e) {
			return {
				title: '',
				path: '/pages/index/index'
			}
		},
		methods: {
			
		}
	}
</script>

<style lang="less">
	image{
		width: 100%;
		height: 100%;
	}
	.cate{
		.kong{
			margin-top: 160rpx;
			.kong_img{
				width: 450rpx;
				height: 287rpx;
				margin: 0 auto;
			}
			.kong_text{
				text-align: center;
				font-weight: 500;
				color: #666666;
				font-size: 34rpx;
			}
		}
		.list{
			width: 100%;
			background-color: #FFFFFF;
			padding: 12rpx 30rpx;
			display: flex;
			align-items: center;
			justify-content: space-between;
			margin-top: 10rpx;
			box-sizing: border-box;
			.l_left{
				display: flex;
				// align-items: center;
				.l_img{
					width: 143rpx;
					height: 139rpx;
				}
				.l_text{
					font-size: 28rpx;
					color: #333333;
					font-weight: 700;
					margin-left: 14rpx;
					padding-top: 20rpx;
					box-sizing: border-box;
					width: 350rpx;
					.t_bottom{
						color: #666666;
						font-size: 22rpx;
						margin-top: 20rpx;
					}
				}
			}
			.l_right{
				text-align: right;
				
				.money{
					font-size: 34rpx;
					font-weight: 500;
					color: #fcc521;
				}
				
			}
			
		}
	}
</style>
